#include <map>
#include <string>
#include "Log.hpp"

class Directory
{
public:
    Directory()
    {
        addWord("hello", "你好");
        addWord("handsome", "帅气的");
        addWord("apple", "苹果");
        addWord("computer", "计算机");
        lg.LogMessage(Debug, "字典初始化啦\n");
    }
    
    void addWord(const std::string word, const std::string meaning)
    {
        dir[word] = meaning;
    }

    std::string translate(const std::string word)
    {
        std::cout << "要找的单词是: " << word << std::endl;
        if(dir.find(word) != dir.end())
        {
            std::cout << "找到了: " << dir[word] << std::endl;
            return dir[word];
        }
        else return "没找到这个单词捏\n";
    }

public:
    std::map<std::string, std::string> dir;
};